package me.sealer.ssm.shiro.authc;

import org.apache.shiro.authc.HostAuthenticationToken;
import org.apache.shiro.authc.RememberMeAuthenticationToken;

import java.io.Serializable;

/**
 * 功能描述： $ GithubToken
 *
 * @author sealer
 * @email 1178884049@qq.com
 * @date 2019年12月12日 14时49分59秒
 */
public class OpenAuth2Token implements HostAuthenticationToken, RememberMeAuthenticationToken, Serializable {
    private String username;
    private String oauth2Principal;
    private String host;

    public OpenAuth2Token(String username, String oauth2Principal) {
        this(username, oauth2Principal, null);
    }

    public OpenAuth2Token(String username, String oauth2Principal, String host) {
        this.username = username;
        this.oauth2Principal = oauth2Principal;
        this.host = host;
    }

    @Override
    public String getHost() {
        return host;
    }

    @Override
    public boolean isRememberMe() {
        return false;
    }

    @Override
    public Object getPrincipal() {
        return username;
    }

    @Override
    public Object getCredentials() {
        return oauth2Principal;
    }
}
